const accessMap = {
  admin: {
    canWelcome: true,
    canGoods: true,
    canCoupon: true,
    canOrder: true,
    canConsignment: true,
    canFinance: true,
    canUser: true,
  },
  user: {
    canWelcome: true,
    canGoods: false,
    canCoupon: false,
    canOrder: false,
    canConsignment: false,
    canFinance: false,
    canUser: true,
  },
};

export default function access(initialState: { currentUser?: User.CurrentUserResult | undefined }) {
  const { currentUser } = initialState || {};
  if (!currentUser) {
    return {};
  }
  return currentUser && currentUser.access && accessMap[currentUser.access];
}
